package swing;

import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;



public class Fenetre extends JFrame implements ActionListener {
	public JButton arriere;
	public JButton ailierG;
	public JButton ailierD;
	public JButton centreD;
	public JButton centreG;
	public JButton ouvreur;
	public JButton mele;
	public JButton treize;
	public JButton secondeG;
	public JButton secondeD;
	public JButton pilierG;
	public JButton pilierD;
	public JButton talonneur;
	
	
	public Fenetre() {
		this.setTitle("Rugby League");
		this.setSize(560, 660);
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setContentPane(new Panneau());
		this.getContentPane();
		this.setResizable(false);
		this.setVisible(true);
		setLayout(null); 
		JButton errase = new JButton("Effacer");
		errase.setVisible(true);
		errase.setBounds(400,10,100,30);
		this.getContentPane().add(errase);
		errase.addActionListener(this);
		equipe();
		
		addplayer(this.getContentPane());
		
	}

	private void addplayer(Container contentPane) {
		contentPane.add(arriere);
		contentPane.add(ailierG);
		contentPane.add(ailierD);
		contentPane.add(centreG);
		contentPane.add(centreD);
		contentPane.add(ouvreur);
		contentPane.add(mele);
		contentPane.add(treize);
		contentPane.add(secondeD);
		contentPane.add(secondeG);
		contentPane.add(pilierD);
		contentPane.add(talonneur);
		contentPane.add(pilierG);
		
		arriere.setBounds(1,1, 20,20);
		ailierG.setBounds(26,1, 20,20);
		centreD.setBounds(51,1, 20,20);
		centreG.setBounds(76,1, 20,20);
		ailierD.setBounds(101,1, 20,20);
		ouvreur.setBounds(126,1, 20,20);
		mele.setBounds(151,1, 20,20);
		treize.setBounds(176,1, 20,20);
		secondeG.setBounds(201,1, 20,20);
		secondeD.setBounds(226,1, 20,20);
		pilierG.setBounds(251,1, 20,20);
		talonneur.setBounds(276,1, 20,20);
		pilierD.setBounds(301,1, 20,20);
		
		
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		System.out.print("coucou");
	}
	
	public void equipe(){
		
		arriere = new DragButton("1");
		ailierG = new DragButton("2");
		ailierD= new DragButton("5");
		centreD = new DragButton("3");
		centreG= new DragButton("4");
		ouvreur= new DragButton("6");
		mele= new DragButton("7");
		treize= new DragButton("13");
		secondeG= new DragButton("11");
		secondeD= new DragButton("12");
		pilierG= new DragButton("8");
		pilierD= new DragButton("10");
		talonneur = new DragButton("9");
		
	}
}